package com.ruoyi.gas.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.gas.mapper.GasDeviceMapper;
import com.ruoyi.gas.domain.GasDevice;
import com.ruoyi.gas.service.IGasDeviceService;

/**
 * 设备信息Service业务层处理
 *
 * @author ruoyi
 * @date 2023-12-08
 */
@Service
public class GasDeviceServiceImpl implements IGasDeviceService
{
    @Autowired
    private GasDeviceMapper gasDeviceMapper;

    /**
     * 查询设备信息
     *
     * @param deviceId 设备信息主键
     * @return 设备信息
     */
    @Override
    public GasDevice selectGasDeviceByDeviceId(String deviceId)
    {
        return gasDeviceMapper.selectGasDeviceByDeviceId(deviceId);
    }

    /**
     * 查询设备信息列表
     *
     * @param gasDevice 设备信息
     * @return 设备信息
     */
    @Override
    public List<GasDevice> selectGasDeviceList(GasDevice gasDevice)
    {
        return gasDeviceMapper.selectGasDeviceList(gasDevice);
    }

    /**
     * 新增设备信息
     *
     * @param gasDevice 设备信息
     * @return 结果
     */
    @Override
    public int insertGasDevice(GasDevice gasDevice)
    {
        gasDevice.setCreateTime(DateUtils.getNowDate());
        return gasDeviceMapper.insertGasDevice(gasDevice);
    }

    /**
     * 修改设备信息
     *
     * @param gasDevice 设备信息
     * @return 结果
     */
    @Override
    public int updateGasDevice(GasDevice gasDevice)
    {
        return gasDeviceMapper.updateGasDevice(gasDevice);
    }

    /**
     * 批量删除设备信息
     *
     * @param deviceIds 需要删除的设备信息主键
     * @return 结果
     */
    @Override
    public int deleteGasDeviceByDeviceIds(String[] deviceIds)
    {
        return gasDeviceMapper.deleteGasDeviceByDeviceIds(deviceIds);
    }

    /**
     * 删除设备信息信息
     *
     * @param deviceId 设备信息主键
     * @return 结果
     */
    @Override
    public int deleteGasDeviceByDeviceId(String deviceId)
    {
        return gasDeviceMapper.deleteGasDeviceByDeviceId(deviceId);
    }

    @Override
    public List<Map<String, Object>> getDeviceCountTrend() {
        return gasDeviceMapper.getDeviceCountTrend();
    }

    @Override
    public int getCountByType(int type) {
        return gasDeviceMapper.getCountByType(type);
    }

    @Override
    public int getCompanyTop(Long companyId, Integer status) {
        return gasDeviceMapper.getCompanyTop(companyId, status);
    }

    @Override
    public List<GasDevice> selectDeviceList() {
        return gasDeviceMapper.selectDeviceList();
    }
}
